<?php $this->_extends('_layouts/main_layout'); ?>
<?php $this->_block('title'); ?>
	Edit <?php echo $name; ?>
<?php $this->_endblock(); ?>

<?php $this->_block('contents'); ?>
<div id="content" class="box">
	<h1>Edit <?php echo $name; ?></h1>
		<?php if (isset($infos)) 
				{
					foreach ($infos as $info)
					{
		?>
				<p class="msg info"><?php echo $info;?></p>
		<?php		}
				}
		?>
		<fieldset>
			<legend>Edit <?php echo $name; ?></legend>
		<?php if (isset($errors)) 
				{
					foreach ($errors as $error)
					{
		?>
				<p class="msg error"><?php echo $error;?></p>
		<?php		}
				}
		?>
		<form method="post" action="<?php echo url('pixel/update');?>">
		<input type="hidden" name="id" value="<?php echo isset($pixel['id']) ? $pixel['id'] : ''; ?>" />
		
		<table class="nostyle">
			<tr>
				<td>Site Domain:</td>
				<td>
					<select name="siteid">
						<option value="">--Choose a Site--</option>
						<?php foreach($sites as $site) { ?>
						<option value="<?php echo $site['id'];?>" <?php echo (isset($pixel['siteId']) && $pixel['siteId'] == $site['id']) ?  'selected="selected"' : ''; ?>><?php echo $site['name'];?></option>
						<?php } ?>
					</select>
				</td>
			</tr>
			<tr>
				<td>Position:</td>
				<td>
					<select name="pos">
						<option value="">--Choose a Pixel Position--</option>
						<option value="home" <?php echo ('home' == $pixel['pos']) ?  'selected="selected"' : ''; ?>>Home</option>
						<option value="after_basic_reg" <?php echo ('after_basic_reg' == $pixel['pos']) ?  'selected="selected"' : ''; ?>>After Basic Reg</option>
						<option value="after_full_reg" <?php echo ('after_full_reg' == $pixel['pos']) ?  'selected="selected"' : ''; ?>>After Full Reg</option>
						<option value="more_credit" <?php echo ('more_credit' == $pixel['pos']) ?  'selected="selected"' : ''; ?>>More Credit</option>
						<option value="leader_board" <?php echo ('leaderboard' == $pixel['pos']) ?  'selected="selected"' : ''; ?>>Leaderboard</option>
						<option value="not_login" <?php echo ('not_login' == $pixel['pos']) ?  'selected="selected"' : ''; ?>>Not Login</option>
					</select>
				</td>
			</tr>
			<tr>
				<td>Pixel:</td>
				<td>
					<textarea name="pixel"><?php if (isset($pixel['pixel'])) echo $pixel['pixel'];?></textarea>
				</td>
			</tr>
			<tr>
				<td colspan="2" class="t-right"><input type="submit" class="input-submit" value="Save"/></td>
			</tr>
		</table>
		</form>
	</fieldset>
</div>
<?php $this->_endblock(); ?>